import { createApp } from 'vue'
import App from './App.vue'

import './assets/style.less'

const app = createApp(App)

// ---------------- pinia 存储 ----------------------------
import { createPinia } from 'pinia' // 存储
const pinia = createPinia()
app.use(pinia) // pinia

// ---------------- router ----------------------------
import router from './utils/router' // 路由
app.use(router) // 路由

// ---------------- element plus ---------------
import ElementPlus from 'element-plus' // 全局导入
// import 'element-plus/dist/index.css' // 样式导入
import zhCn from 'element-plus/es/locale/lang/zh-cn' // 中文 报错,原因未知
app.use(ElementPlus, { locale: zhCn }) // 使用 elment-plus

// ----------------  echarts ---------------------
import ECharts from 'vue-echarts'
import { use } from 'echarts/core'
// 浏览器提示 [Violation]Added non-passive event listener
// import 'default-passive-events'  
// 升级 element-plus -> 2.1.11
// import ECharts modules manually to reduce bundle size
import { CanvasRenderer } from 'echarts/renderers'
import { BarChart, PieChart, CandlestickChart } from 'echarts/charts'
import { GridComponent, DataZoomComponent, TooltipComponent, LegendComponent, TitleComponent } from 'echarts/components'
use([CanvasRenderer, BarChart, PieChart, GridComponent, TooltipComponent, LegendComponent, TitleComponent, DataZoomComponent, CandlestickChart])
// register globally (or you can do it locally)
app.component('v-chart', ECharts)

// ---------------- vxe-table ------------------
import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
app.use(VXETable)


// ---------------- 二次封装 element-plus 组件 自动导入 ---------------
import hfUI from '../src/components'
// import hfUI from '../lib/index.es'
// import '../lib/style.css'
app.use(hfUI)

app.mount('#app')
